// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.linqingying.gitcode.pullrequest.data.service

import com.intellij.openapi.progress.ProgressIndicator
import org.jetbrains.annotations.CalledInAny
import com.linqingying.gitcode.api.data.GCRefUpdateRule
import com.linqingying.gitcode.pullrequest.data.GCPRIdentifier
import com.linqingying.gitcode.pullrequest.data.GCPRMergeabilityState
import java.util.concurrent.CompletableFuture

interface GCPRStateService {

  @CalledInAny
  fun loadMergeabilityState(progressIndicator: ProgressIndicator,
                            pullRequestId: GCPRIdentifier,
                            headRefOid: String,
                            prHtmlUrl: String,
                            baseRefUpdateRule: GCRefUpdateRule?): CompletableFuture<GCPRMergeabilityState>


  @CalledInAny
  fun close(progressIndicator: ProgressIndicator, pullRequestId: GCPRIdentifier): CompletableFuture<Unit>

  @CalledInAny
  fun reopen(progressIndicator: ProgressIndicator, pullRequestId: GCPRIdentifier): CompletableFuture<Unit>

  @CalledInAny
  fun markReadyForReview(progressIndicator: ProgressIndicator, pullRequestId: GCPRIdentifier): CompletableFuture<Unit>

  @CalledInAny
  fun merge(progressIndicator: ProgressIndicator, pullRequestId: GCPRIdentifier,
            commitMessage: Pair<String, String>, currentHeadRef: String): CompletableFuture<Unit>

  @CalledInAny
  fun rebaseMerge(progressIndicator: ProgressIndicator, pullRequestId: GCPRIdentifier,
                  currentHeadRef: String): CompletableFuture<Unit>

  @CalledInAny
  fun squashMerge(progressIndicator: ProgressIndicator, pullRequestId: GCPRIdentifier,
                  commitMessage: Pair<String, String>, currentHeadRef: String): CompletableFuture<Unit>
}
